package cn.com.api.mapper.base;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import cn.com.api.entity.ApiU_bonus;

//DAO
public interface U_bonusMapperBase {

	// 根据id查看
	@Select("SELECT * FROM U_BONUS  WHERE ID = #{id}")
	public ApiU_bonus findU_bonusById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM U_bonus")
	public List<ApiU_bonus> findU_bonuss();

	// 添加
	@Insert("INSERT INTO U_BONUS (USER_ID, COUNT, SUMMY, TITLE, ADD_TIME, IS_EXPIRE, TYPE, EXT1, EXT2, EXT3, EXT4, EXT5, "
			+ "DURING_TIME, COUNT_CHARGE, COUNT_FREE, SHOW_TIMES, LATITUDE, LONGITUDE, MAX_MONEY, MIN_MONEY, BLESS_WORD, IS_Pay,is_delete) "
			+ "VALUES (#{user_id}, #{count}, #{summy}, #{title}, #{add_time}, #{is_expire}, #{type}, "
			+ "#{ext1}, #{ext2}, #{ext3}, #{ext4}, #{ext5}, #{during_time}, #{count_charge}, #{count_free}, #{show_times}, "
			+ "#{latitude}, #{longitude}, #{max_money}, #{min_money}, #{bless_word}, #{is_pay},#{is_delete})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	public int insertU_bonus(ApiU_bonus u_bonus);

	// 修改
	@Update("UPDATE U_BONUS SET USER_ID = #{user_id,jdbcType=VARCHAR}, COUNT = #{count,jdbcType=INTEGER}, SUMMY = #{summy,jdbcType=NUMERIC}, TITLE = #{title,jdbcType=VARCHAR}, "
			+ "ADD_TIME = #{add_time,jdbcType=VARCHAR}, IS_EXPIRE = #{is_expire,jdbcType=INTEGER}, TYPE = #{type,jdbcType=INTEGER}, EXT1 = #{ext1,jdbcType=VARCHAR}, EXT2 = #{ext2,jdbcType=VARCHAR}, "
			+ "EXT3 = #{ext3,jdbcType=VARCHAR}, EXT4 = #{ext4,jdbcType=VARCHAR}, EXT5 = #{ext5,jdbcType=VARCHAR}, DURING_TIME = #{during_time,jdbcType=INTEGER}, COUNT_CHARGE = #{count_charge,jdbcType=INTEGER}, "
			+ "COUNT_FREE = #{count_free,jdbcType=INTEGER}, SHOW_TIMES = #{show_times,jdbcType=INTEGER}, LATITUDE = #{latitude,jdbcType=VARCHAR}, LONGITUDE = #{longitude,jdbcType=VARCHAR}, "
			+ "MAX_MONEY = #{max_money,jdbcType=NUMERIC}, MIN_MONEY = #{min_money,jdbcType=NUMERIC}, BLESS_WORD = #{bless_word,jdbcType=VARCHAR}, IS_PAY = #{is_pay,jdbcType=INTEGER},is_delete = #{is_delete,jdbcType=INTEGER} WHERE ID = #{id}")
	public int updateU_bonus(ApiU_bonus u_bonus);

	// 删除
	@Delete("DELETE FROM U_BONUS  WHERE ID = #{id}")
	public int deleteU_bonus(Integer id);

	// 软删除
	@Delete("update U_BONUS set is_delete = 1 WHERE ID = #{id}")
	public int deleteBonus(Integer id);

	// Foreign keys revelant

	// region Indexs revelant

}
